<?php
/**
 * Created by Bruce.
 * IDE: PhpStorm
 * Date: 2018/8/7
 * Time: 16:55
 */

namespace app\park\model;


use think\Db;

class QueryIsAdminModel
{
    private $db;

    function __construct()
    {
        $this->db = Db::connect();
    }

    public function query($openId)
    {
        $res = $this->db->table('user_info')->field('admin')->where('open_id', $openId)->select();
        $res = $res[0];
        $result = array('code' => '200');
        if ($res['admin'] == 0) {
            $result['result'] = 'false';
        } else {
            $result['result'] = 'true';
        }
        return $result;
    }

    function __destruct()
    {
        // TODO: Implement __destruct() method.
        if ($this->db != null) {
            $this->db->close();
        }
    }
}